Skip to content

CachingAllocator: report the current requested size in reused block - #51730

Open
felicepantaleo wants to merge 1 commit into
cms-sw:masterfrom
felicepantaleo:caching-allocator-reuse
Open

CachingAllocator: report the current requested size in reused block#51730
felicepantaleo wants to merge 1 commit into
cms-sw:masterfrom
felicepantaleo:caching-allocator-reuse

Conversation

@felicepantaleo

@felicepantaleo felicepantaleo commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

When tryReuseCachedBlock reuses a cached block, it copies the whole cached descriptor over the descriptor of the new allocation. This also overwrites block.requested with the size requested by the previous user of the block. cacheStatus().requested therefore reports stale sizes. The accounting does not drift, because free() subtracts the same value that allocate() added, but the reported value is wrong after any reuse.

…ck is reused

tryReuseCachedBlock assigned the cached block descriptor over the descriptor of the new
allocation, and then restored the queue. That also replaced block.requested with the size
requested by the previous allocation that used the block, so cacheStatus().requested reported
the sizes of earlier allocations.

Take from the cached block only what the cache owns, that is the buffer, the event and the bin
size, and leave the queue, the bin and the requested size of the new allocation in place. This
also removes one of the two copies of the block descriptor, and resolves the two open TODOs.

Take ownership of the cached block with extract before it is modified, and update the accounting
after the operations that can throw.

Add a test that allocates two different sizes from the same bin and checks the reported sizes.
@cmsbuild

cmsbuild commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

cms-bot internal usage

@cmsbuild

Copy link
Copy Markdown
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-51730/50657

@cmsbuild

Copy link
Copy Markdown
Contributor

A new Pull Request was created by @felicepantaleo for master.

It involves the following packages:

  • HeterogeneousCore/AlpakaInterface (heterogeneous)

@cmsbuild, @fwyzard, @makortel can you please review it and eventually sign? Thanks.
@makortel, @rovere this is something you requested to watch as well.
@ftenchini, @mandrenguyen, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@felicepantaleo

Copy link
Copy Markdown
Contributor Author

@cmsbuild please test

@felicepantaleo

Copy link
Copy Markdown
Contributor Author

type bugfix

@felicepantaleo

Copy link
Copy Markdown
Contributor Author

type ngt

@cmsbuild

Copy link
Copy Markdown
Contributor

-1

Failed Tests: RelVals-AMD_W7900
Size: This PR adds an extra 28KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-7532cb/55455/summary.html
COMMIT: d0a34e4
CMSSW: CMSSW_20_1_X_2026-08-18-1100/el9_amd64_gcc14
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/51730/55455/install.sh to create a dev area with all the needed externals and cmssw changes.

DAS Queries: The DAS query tests failed, see the summary page for details.

Failed RelVals-AMD_W7900

  • 37634.40337634.403_TTbar_14TeV+Run4D127_Patatrack_PixelOnlyAlpaka_Validation/step2_TTbar_14TeV+Run4D127_Patatrack_PixelOnlyAlpaka_Validation.log

Comparison Summary

Summary:

  • You potentially removed 2 lines from the logs
  • Reco comparison results: 4 differences found in the comparisons
  • DQMHistoTests: Total files compared: 45
  • DQMHistoTests: Total histograms compared: 3592269
  • DQMHistoTests: Total failures: 3
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3592248
  • DQMHistoTests: Total skipped: 18
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 44 files compared)
  • Checked 195 log files, 163 edm output root files, 45 DQM output files
  • TriggerResults: no differences found

NVIDIA_H100 Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 79 differences found in the comparisons
  • DQMHistoTests: Total files compared: 7
  • DQMHistoTests: Total histograms compared: 173739
  • DQMHistoTests: Total failures: 7797
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 165942
  • DQMHistoTests: Total skipped: 0
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 6 files compared)
  • Checked 25 log files, 20 edm output root files, 7 DQM output files
  • TriggerResults: no differences found

NVIDIA_L4 Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 69 differences found in the comparisons
  • DQMHistoTests: Total files compared: 7
  • DQMHistoTests: Total histograms compared: 173739
  • DQMHistoTests: Total failures: 8443
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 165296
  • DQMHistoTests: Total skipped: 0
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 6 files compared)
  • Checked 25 log files, 20 edm output root files, 7 DQM output files
  • TriggerResults: no differences found

NVIDIA_L40S Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 62 differences found in the comparisons
  • DQMHistoTests: Total files compared: 7
  • DQMHistoTests: Total histograms compared: 173739
  • DQMHistoTests: Total failures: 7843
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 165896
  • DQMHistoTests: Total skipped: 0
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 6 files compared)
  • Checked 25 log files, 20 edm output root files, 7 DQM output files
  • TriggerResults: no differences found

NVIDIA_T4 Comparison Summary

Summary:

Max Memory Comparisons exceeding threshold NVIDIA_H100

@cms-sw/core-l2 , I found 1 workflow step(s) with memory usage exceeding the error threshold:

Expand to see workflows ...
  • Error: Workflow 37634.7503_TTbar_14TeV+Run4D127_HLTHeterogeneousValid step2 max memory diff -201.2 exceeds +/- 30.0 MiB

Max Memory Comparisons exceeding threshold NVIDIA_L40S

@cms-sw/core-l2 , I found 1 workflow step(s) with memory usage exceeding the error threshold:

Expand to see workflows ...
  • Error: Workflow 37634.7503_TTbar_14TeV+Run4D127_HLTHeterogeneousValid step2 max memory diff -211.3 exceeds +/- 30.0 MiB

@fwyzard

fwyzard commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

The bug is no longer possible to write, instead of being corrected after the fact.

What dos it mean ?

@fwyzard

fwyzard commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

I have no idea what the description of the PR even means.

Please make only the change that is necessary for the fix, and write a reasonable and correct description.

@fwyzard

fwyzard commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

-heterogeneous

@fwyzard

fwyzard commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

The accounting is updated after the operations that can throw.

What operations do you think can throw ?

@fwyzard

fwyzard commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Can you do a minimal fix, for example

           // associate the cached buffer to the new queue
           auto queue = std::move(*(block.queue));
+          // update the requested size
+          auto requested = block.requested;
           // TODO cache (or remove) the debug information and use std::move()
           block = iBlock->second;
           block.queue = std::move(queue);
+          block.requested = requested;

?

@fwyzard

fwyzard commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

#51741 has (only) the minimal fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants